<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on指令</title>
    <script src="../vue.js"></script>
    <style>
        .parentStyle{
            width: 200px;
            height: 200px;
            background:skyblue;
            border 1px solid #0000
        }
        .childStyle{
            width: 100px;
            height: 100px;
            margin: 10px;
            background:yellow;
            border 1px solid #0000
        }
    </style>
</head>
<body>
    <div id="app"> 
        <!--
            防止事件冒泡的方法有两种
            第一种：在子元素种使用.stop修饰符 <div class="childStyle" @click.stop="clickChild()"></div>
            第二种:在父元素种使用.self
            <div class="parentStyle" @click.self="clickParent()">
               <div class="childStyle" @click="clickChild()"></div>
            </div>
        -->
        <div class="parentStyle" @click.self="clickParent()">
            <div class="childStyle" @click="clickChild()"></div>
        </div>
    </div>
</body>
</html>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            msg:"Hello Vue"
        },
        methods:{
            clickParent:function(){
                console.log("parent");
            },
            clickChild:function(){
                console.log("childen");
            }
        }
    });
</script>